package com.sptpc.exam.service.impl;

import com.sptpc.exam.mapper.StudentMapper;
import com.sptpc.exam.model.Student;
import com.sptpc.exam.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements IStudentService {

    @Autowired
    StudentMapper mapper;

    @Override
    public int addNewStudent(Student stu) {
        return mapper.addnew(stu);
    }

    @Override
    public List<Student> displayAll() {
        return mapper.search();
    }

    @Override
    public int deleteStudent(Long id) {
        return mapper.delete(id);
    }

    @Override
    public void updateStudent(Student stu) {
        mapper.update(stu);
    }

    @Override
    public Student selectById(Long id) {
        return mapper.selectStudentById(id);
    }


}
